Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips: GitHub browse and Switch-create Tabs #179

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AnirudhG07
Copy link
Contributor

Hi!
Instead of making a plugin, I made a keybinding to browse on Github using the popularly used gh command. I coudnt combine the 2 commands into 1, but if you can it would be GREAT!

Also I have added Tips to Close #163. Please verify that too. Although I would like to know, cant it be done for all number keys 1-9 instead at once, instead of all separately written?(if someone wants that)
Please let me know for any changes and I would be glad to do so.
Thanks!!!

[[manager.prepend_keymap]]
on = [ "g", "f"]
run = '''
shell 'gh browse $(git ls-files $0) --branch=$(git branch --show-current)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why $(git ls-files $0) and --branch=$(git branch --show-current) is needed here?

Copy link
Contributor Author

@AnirudhG07 AnirudhG07 Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if you just do gh browse wherever you are in the repo, it will open the https://github.com/name/repo_name instead of location of file.
And branch is required since if not mentioned, it will always go to main/master branch even if you are in some other branch locally in yazi.
That's why the above keybinding will simply open the exact location of the file. Hope its clear :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that you mention it, I think you should have branch for the 2nd keybinding I mentioned.
But it would be create to combine both of them into 1, since "gf" doesnt work for hovered directory.

@AnirudhG07
Copy link
Contributor Author

Based on #188 Should I remove 2nd commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New tip: Create tab when switching if it doesn't already exist
2 participants